package com.djy.shxt.nemt.api;

import com.djy.shxt.nemt.domain.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author daijiyong
 */
@Api(tags = "测试接口3")
@RestController
@RequestMapping("/api/university")
public class UniversityApi {

    private static final Logger log = LoggerFactory.getLogger(UniversityApi.class);

    /**
     * 测试内容
     *
     * @param university 测试内容
     * @return ApiResult
     */
    @GetMapping(value = "/speciality/list/{university}")
    @ApiOperation(value = "测试内容", response = ApiResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "university", value = "测试内容", dataType = "String", required = true),
    })
    public ApiResult getListByUniversity(@PathVariable("university") String university) {
        log.info(university);
        ApiResult apiResult = ApiResult.success("测试内容");
        List<String> specialities = new ArrayList<>();
        specialities.add("测试内容");
        specialities.add("测试内容");
        specialities.add("测试内容");
        specialities.add("测试内容");
        specialities.add("测试内容");
        apiResult.put("specialities", specialities);
        return apiResult;
    }

    /**
     * 测试内容
     *
     * @param query 测试内容
     * @return ApiResult
     */
    @GetMapping(value = "/list/{query}")
    @ApiOperation(value = "测试内容", response = ApiResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "query", value = "测试内容", dataType = "String", required = true),
    })
    public ApiResult getSpecialitiesByQuery(@PathVariable("query") String query) {
        ApiResult apiResult = ApiResult.success("测试内容");
        log.info(query);
        List<String> universities = new ArrayList<>();
        universities.add("测试内容");
        universities.add("测试内容");
        universities.add("测试内容");
        universities.add("测试内容");
        universities.add("测试内容");
        apiResult.put("universities", universities);
        return apiResult;
    }

}
